<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/


  defined('_JEXEC') or die('Retricted Access');
  $limited = JRequest::getVar('limited', 0);
  $user = JFactory::getUser();
  global $jbconfig;
    
?>
<?php JHTML::_('behavior.modal', 'a.modal'); ?>
<script type="text/javascript">
/* <![CDATA[ */
	var siteurl = '<?php echo JURI::root(); ?>';
	var Itemid = '<?php echo $this->Itemid?>';
    var table_name = 'ja_resumes';
    function submitbutton(pressbutton,max){
    	form = document.adminForm;
    	if (!check_list(max, 'adminForm'))
    	{
    		if (pressbutton=='multi_starred')
    			alert('<?php echo JText::_('Please make a selection from the list to save'); ?>');
    		else
    			alert('<?php echo JText::_('Please make a selection from the list to view detail'); ?>');
    		return;
    	}
		
	    
		if(pressbutton == "sendemail"){
			var sendmail = document.getElementById("sendmail");
			sendmail.style.display = "block";
		} else {
			form.task.value = pressbutton;
			form.submit();
		}
    }
    /* ]]> */
</script>

<div id="jobboard-content">
<?php 
	$filter_location = JRequest::getVar('location_id','');
	$filter_category = JRequest::getVar('category','');
	$is_filter = false;
	$text = JText::_('Your search');
	if ($filter_category)
	{
		$is_filter = true;
		
		$text .= " ".JText::_("for")." <strong class='highlight'>".getCategories($filter_category)."</strong>";
		
	}
	if ($filter_location)
	{
		$is_filter = true;
		
		$text .= " ".JText::_("in")." <strong class='highlight'>".getLocation($filter_location)."</strong>";
		
	}
	$text .= " ".JText::_("return")." ".count($this->items)." ".JText::_("resume(s)")." ";
	
	if ($is_filter)
		echo "<span class=\"ja-resumesearch-result\">".$text."</span>";
?>
<form name="adminForm" action="<?php echo JRoute::_('index.php')?>" method="post">

	<?php if (checkPermission('can_search_resume')) { ?> 
		 <div class="moduletable employers-box"> 
	    	<table class="tablelist employerslist">
				<tr>
					<td align="left" width="100%">
						<?php echo JText::_( 'Filter' ); ?>:
						<input type="text" name="resume_search" id="resume_search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
	                    &nbsp;&nbsp;<button class="button" onclick="this.form.submit();">&nbsp;<?php echo JText::_( 'Go' ); ?>&nbsp;</button>&nbsp;&nbsp;
						<button class="button" onclick="document.getElementById('resume_search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
					</td>
					<td nowrap="nowrap">
						<?php if($this->lists['filter']){?>
							<?php foreach ($this->lists['filter'] as $row){?>
								<?php echo $row;?>
							<?php }?>
						<?php }?>
					</td>
				</tr>
			</table>
		</div>
	<?php }?>
    
    
	<!--	BEGIN: All Resume List-->
	<?php 
	if(!count($this->items)>0){
		echo JText::_('No Candidates are found!');
	} 
	elseif(isset($this->fieldlist) && count($this->fieldlist)>0){
		jimport('joomla.filesystem.file');
		$theme = JRequest::getVar('theme');
		if (!$theme)
			$theme = $jbconfig['general']->get('theme', 'default');
		$path_themes = dirname(__FILE__).DS.'themes'.DS.$theme.DS.'jalist-item.php';
		if(JFile::exists($path_themes)){
			if(file_exists(dirname(__FILE__).DS.'themes'.DS.$theme.DS.'style.css')){
		    	JHTML::stylesheet('style.css', "components/com_jajobboard/views/jaresumes/tmpl/themes/$theme/");
		    }	
		    include $path_themes;					
		}
		elseif(JFile::exists(dirname(__FILE__).DS.'themes'.DS.'default'.DS.'jalist-item.php')){
			if(file_exists(dirname(__FILE__).DS.'themes'.DS.'default'.DS.'style.css')){
		    	JHTML::stylesheet('style.css', "components/com_jajobboard/views/jaresumes/tmpl/themes/default/");
		    }	
			include dirname(__FILE__).DS.'themes'.DS.'default'.DS.'jalist-item.php';
		}
		elseif(JFile::exists(JPATH_FILE.DS.'components'.DS.'com_jajobboard'.DS.'views'.DS.'jaresumes'.DS.'tmpl'.DS.'themes'.DS.'default'.DS.'jalist-item.php')){
			if(file_exists(dirname(__FILE__).DS.'themes'.DS.'default'.DS.'style.css')){
		    	JHTML::stylesheet('style.css', "components/com_jajobboard/views/jaresumes/tmpl/themes/default/");
		    }	
			include JPATH_FILE.DS.'components'.DS.'com_jajobboard'.DS.'views'.DS.'jaresumes'.DS.'tmpl'.DS.'themes'.DS.'default'.DS.'jalist-item.php';
		}
	}
	?>
	<!--	END: All Resume List-->
	
	<input type="hidden" name="option" value="<?php echo JBCOMNAME; ?>" />
	<input type="hidden" name="boxchecked" id="boxcheckedadminForm" value="0" />
	<input type="hidden" name="boxcheck" value="0" />
	<input type="hidden" name="view" value="jaresumes" />
    <input type="hidden" name="task" id="task" value="" />
	<input type="hidden" id="cids" name="cids[]" value="" />
    <input type="hidden" name="layout" value="<?php echo JRequest::getVar('layout')?JRequest::getVar('layout'):'jalist'; ?>" />
    <input type="hidden" id="total_item" name="total_item" value="<?php echo count($this->items); ?>" />
    <input type="hidden" name="field" value="" />
    <input type="hidden" name="star_only" value="0" />
    <input type="hidden" name="pre_layout" value="jalist" />
	<input type="hidden" name="filter_order" id="filter_order" value="<?php echo $this->lists['order']; ?>" />
	<input type="hidden" name="filter_order_Dir" id="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
    <input type="hidden" name="Itemid" value="<?php echo $this->Itemid; ?>" />
    <?php if(JRequest::getVar('layout')=='jaemployerlist'){?>
    <input type="hidden" name="remove_starred" value="1" />
    <?php }?>
	<?php echo JHTML::_( 'form.token' ); ?>	
 </form>
 </div>